<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>填写订单信息 - 爽客网</title>
<%@include file="../common/js.jsp" %>
<%@include file="../common/css.jsp" %>
<link href="css/detail.css" type="text/css" rel="stylesheet" />
</head>
<body>
<%@include file="../common/header.jsp" %>
<div class="wrap">
    	<div class="w980 mg">
            <div class="order_tip"></div>
            <div class="f_order_title">
            	<span class="fl">预订：</span><i class="fl">${ticket.name}</i>
            	<div class="fr pr clearfix">
            	<%--
                	<a href="#" class="f_orderbg ensure_1">优惠承诺</a>
                    <a href="#" class="f_orderbg ensure_2">入园保障</a>
                    <a href="#" class="f_orderbg ensure_3">放心保障</a>
                    <div class="f_tc_tip_1">
                    	如您在爽客的订购价格高于景点的当天门市价，我们无条件退还差价。
                        <span class="f_arror"></span>
                    </div>
                    <div class="f_tc_tip_2">
                    	如您在爽客的订购价格高于景点的当天门市价，我们无条件退还差价。
                        <span class="f_arror"></span>
                    </div>
                    <div class="f_tc_tip_3">
                    	如您在爽客的订购价格高于景点的当天门市价，我们无条件退还差价。
                        <span class="f_arror"></span>
                    </div>
                --%></div>
            </div>
            <!-- content -->
            <form action="buy.htm" method="post" id="order_form">
            <input type="hidden" name="tid" value="${ticket.id}"/>
            <input type="hidden" name="orderTime" value="${udate}"/>
            <div class="f_detail_box">
            	<!-- pro-info-->
            	<div class="f_pro_box">
                	<h1><i class="f_orderbg"></i>产品信息</h1>
                    <table class="f_order_list dis1">
                    	<thead>
                        	<th class="col1">游玩日期</th>
                            <th class="col2">名称</th>
                            <th class="col3">门市价</th>
                            <th class="col4">爽客价</th>
                            <th class="col5">数量</th>
                            <th class="col6">小计</th>
                        </thead>
                    	<tbody>
                        	<tr>
                        		<td class="col1"><span>${udate}</span></td>
                                <td class="col2">
                                <a href="ticket.htm?id=${tid}" class="clrblue">${ticket.name}(成人门票)</a>
                               
                              	</td>
                                <td class="col3"><i style="text-decoration:line-through;">¥${ticket.priceMarket}</i></td>
                                <td class="col4"><span>¥${buytp.priceA}</span></td>
                                <td class="col5">
                                	<div class="nums_wrap">
                                        <a href="javascript:;" class="f_orderbg minus" onclick="minusOne();"></a>
                                        <input type="text" value="${count}"  name="count" id="rnums" readonly="readonly"/>
                                        <a href="javascript:;" class="f_orderbg add" onclick="addOne();"></a>
                                    </div>
                                </td>
                                <td class="col6"><span>¥<span id="totalM">${buytp.priceA * count}</span></span></td>
                            </tr>
                           
                             <c:if test="${not empty countC}">
                                 <tr>
		                       		<td class="col1"><span>${udate}</span></td>
		                               <td class="col2">
		                               <a href="ticket.htm?id=${tid}" class="clrblue">${ticket.name}(儿童门票)</a>
		                              
		                             	</td>
		                               <td class="col3"><i style="text-decoration:line-through;">¥${ticket.priceMarket}</i></td>
		                               <td class="col4"><span>¥${buytp.priceC}</span></td>
		                               <td class="col5">
		                               	<div class="nums_wrap">
		                                       <a href="javascript:;" class="f_orderbg minus" onclick="minusOneC();"></a>
		                                       <input type="text" value="${countC}"  name="countC" id="rnumsc" readonly="readonly"/>
		                                       <a href="javascript:;" class="f_orderbg add" onclick="addOneC();"></a>
		                                   </div>
		                               </td>
		                               <td class="col6"><span>¥<span id="totalMC">${buytp.priceC * countC}</span></span></td>
		                           </tr>
                            </c:if>
                        </tbody>
                    </table>
                    <c:if test="${not empty ticket.feeInfo}">
                    	<div class="dis1 instruc_wrap">
	                    	<ul class="f_instruc clearfix">
	                        	<li class="current">
	                        		费用说明
	                            </li>
	                            <%--<li>
	                            	退款说明
	                            </li>
	                        --%></ul>
		                       <div class="content">
		                        	${ticket.feeInfo}
		                        </div>
	                    </div>
                    </c:if>
                </div>
                <!-- pro-info--end -->
                <!-- ticketer-info -->
                <div class="f_pro_box">
                	<h1><i class="f_orderbg"></i>取票人信息<span class="clrc06">（请准确填写取票人信息，我们将向取票人手机发送订单短信）</span></h1>
                    <ul class="input_info dis1">
                    	<li>
                        	<label><i class="alarm">*</i>取票人姓名：</label>
                            <input type="text" id="contactor" name="contactor"/>
                        </li>
                        <li>
                        	<label><i class="alarm">*</i>取票人手机：</label>
                            <input type="text" name="phone" id="phone"/>
                            <span class="mt10 ml10"> （免费接收短信，作为订购与取票凭证，请准确填写）</span>
                        </li>
                    </ul>
                </div>
                <!-- ticketer-info--end -->
                <!-- orderbak -->
                <div class="f_pro_box">
                	<h1><i class="f_orderbg"></i>订单备注</h1>
                    <ul class="input_info dis1 remark">
                    	<li>
                        	<label>订单备注：</label>
                            <textarea rows="4" cols="70" name="memo" id="memo"></textarea>
                        </li>
                    </ul>
                </div>
                <!-- orderbak--end -->
                <div class="f_price_wrap">
                	 应付：<span class="f_pay_price"><em>¥</em><em id="totalOrder">${buytp.priceA * count + buytp.priceC * countC}</em></span>
                </div>
                <div class="f-order_commit">
                	<input type="button"  value="确认下单" class="f_orderbg f_btn_sub" id="order_bt"/>
                    <input type="checkbox" class=" cb_style" checked="checked" name="coolprotocol" id="coolprotocol"/><label class="clrblue" for="coolprotocol">同意爽客票务预订协议</label>
                </div>
            </div>
            </form>
            <!-- content--end-->
        </div>
    </div>
    <script type="text/javascript">
    	$(function(){
    		$("#order_bt").click(function(){
    			var contactor = $("#contactor").val();
	    		if(IsNull(contactor)){
	    			alert("请输入联系人");
	    			return ;
	    		}
	    		var phone = $("#phone").val();
	    		if(GGTOOL.mobileCheck(document.getElementById("phone"))){
	    			if(COOL.checkLogin()){
	    				$("#order_form").submit();
	    			}else{
	    				COOL.memberLogin();
	    			}
	    			
	    		}
    		});
    		
    	});
    	
    	function minusOne(){
    		var obj=$("#rnums");
    		var m=parseFloat($("#totalM").val());
    		var n=parseInt(obj.val());
    		if(n-1>0){
    			obj.val(n-1);
    			var p=parseFloat("${buytp.priceA}")*(n-1);
    			if(IsNull("${buytp.priceC}") || parseFloat("${buytp.priceC}") <= 0){
    				$("#totalOrder").html(p);
    			}else{
    				$("#totalOrder").html(p+(parseFloat("${buytp.priceC}")*$("#rnumsc").val()));
    			}
				
				$("#totalM").html(p);
    		}else{
    			alert("最小起订量为1");	
    		}
    		
    	}
    	
    	function addOne(){
    		var obj=$("#rnums");
    		var n=parseInt(obj.val());
    		$.post("roomNum.htm",{roomId:"${room.id}"},function(num){
    			if(num<n+1){
    				alert("最大定量为"+n)
    			}else{
    				obj.val(n+1);
    				var p=parseFloat("${buytp.priceA}")*(n+1);
    				
    				if(IsNull("${buytp.priceC}") || parseFloat("${buytp.priceC}") <= 0){
	    				$("#totalOrder").html(p);
	    			}else{
	    				$("#totalOrder").html(p+(parseFloat("${buytp.priceC}")*$("#rnumsc").val()));
	    			}
    				$("#totalM").html(p);
    			}
    		});
    		
    	}
    	
    	function minusOneC(){
    		var obj=$("#rnumsc");
    		var m=parseFloat($("#totalMC").val());
    		var n=parseInt(obj.val());
    		if(n-1>-1){
    			obj.val(n-1);
    			var p=parseFloat("${buytp.priceC}")*(n-1);
				$("#totalOrder").html(p+(parseFloat("${buytp.priceA}")*$("#rnums").val()));
				$("#totalMC").html(p);
    		}else{
    			alert("最小起订量为0");	
    		}
    		
    	}
    	
    	function addOneC(){
    		var obj=$("#rnumsc");
    		var n=parseInt(obj.val());
    		$.post("roomNum.htm",{roomId:"${room.id}"},function(num){
    			if(num<n+1){
    				alert("最大定量为"+n)
    			}else{
    				obj.val(n+1);
    				var p=parseFloat("${buytp.priceC}")*(n+1);
    				$("#totalOrder").html(p+(parseFloat("${buytp.priceA}")*$("#rnums").val()));
    				$("#totalMC").html(p);
    			}
    		});
    		
    	}
    </script>
</body>
</html>
